package com.sinothk.base.nearby.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sinothk.base.nearby.entity.NearbySearchVo;
import com.sinothk.base.nearby.entity.UserBlogForNearbyDto;
import com.sinothk.base.nearby.entity.UserInfoForNearbyDTO;
import com.sinothk.base.nearby.mapper.NearbyBizMapper;
import com.sinothk.base.nearby.service.INearbyBizService;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.system.vo.LoginUser;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @Description: 附近人
 * @Author: Liangyt
 * @Date: 2022-03-29
 * @Version: V1.0
 */
@Service
public class NearbyBizServiceImpl extends ServiceImpl<NearbyBizMapper, String> implements INearbyBizService {

    @Resource
    private NearbyBizMapper nearbyBizMapper;

    @Override
    public IPage<UserInfoForNearbyDTO> nearbyForUserPage(Page<UserInfoForNearbyDTO> page, NearbySearchVo searchVo) {
        LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        return nearbyBizMapper.nearbyForUserPage(page, searchVo, loginUser.getId());
    }

    @Override
    public IPage<UserBlogForNearbyDto> nearbyForBlogPage(Page<UserBlogForNearbyDto> page, NearbySearchVo searchVo) {
        return nearbyBizMapper.nearbyForBlogPage(page, searchVo);
    }
}
